﻿@model throneOfGames.Models.MainMenuViewModel
@{
    ViewBag.Title = "MainMenu";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section featured {
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h1>@ViewBag.Title.</h1>
                <h2>@ViewBag.Message</h2>
            </hgroup>
        </div>
    </section>
}
<div id="site-container">
    <div id="public-chat">
        <h3>Chat</h3>
        @Html.Partial("_chat")
        @section Scripts
         {
            @Html.Partial("_ChatScript")
        }
    </div>

    <div id="leaderboard">
        <h3>Leaderboard</h3>
        <ul class="nav">
            <li class="nav1"><a href="#kof" class="selected">King of Tokyo</a></li>
            <li class="nav2"><a href="#ttt" class="unSelected">Tic Tac Toe</a></li>
        </ul>
        <ol>
            @foreach (var l in @Model.leaderboardData)
            {
                if(l.Leaderboard.Boardgame.name == "TicTacToe")
                {
                    <li class="TTTLeaderboard">@l.User.userName: @l.score</li>
                }
                else if (l.Leaderboard.Boardgame.name == "King of Tokyo")
                {
                    <li class="KoTLeaderboard">@l.User.userName: @l.score</li>
                }
            }
        </ol>
    </div>
    <div id="main-container">
        <div id="active-games">
            <h3>Active games.</h3>
            <ol>
                @foreach (var g in Model.games)
                {
                    <li>@Html.ActionLink(@g.Boardgame.name, "Lobby", "Game", new { id = @g.ID, user = @User.Identity.Name }, new { })</li>
                }
            </ol>
            </div>

        <div id="create-game">
            <h3>Create a game.</h3>
            <form action="/Game/CreateGame" method="post" id="gameForm">
                <input type="hidden" name="currentUser" id="currentUser" value="@User.Identity.Name" />
                <label>Game:</label>
                <select name="boardgameSelect" id="boardgameSelect">
                    @foreach (var g in Model.boardGames)
                    {
                        <option value="@g.name">@g.name</option>
                    }
                </select>

                <label>Max players:</label>
                <select name="playerSelect" id="playerSelect">
                    <option value="1">Play against CPU</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                </select>

                <label>Private:</label>
                <input type="checkbox" name="privateCheckbox" id="privateCheckbox" value="false" />
                <input type="hidden" name="privateCheckbox" value="true" />
                <input type="submit" class="createGame" value="Create" />
            </form>
        </div>
        @Scripts.Render("~/Scripts/createGame.js")
    </div>
</div>